package com.xiu.travel.config;

import org.springframework.context.annotation.Configuration;

/**
 * @author lijie
 * @date 2023/6/15 18:37
 * @description RestClientConfig
 */
@Configuration
public class ElasticSearchConfig
{

    //注入IOC容器
//    @Bean
//    public ElasticsearchClient elasticsearchClient()
//    {
//        RestClient restClient = RestClient.builder(new HttpHost("112.74.176.124", 8100))
//                .setHttpClientConfigCallback(httpClientBuilder
//                        ->httpClientBuilder.setDefaultHeaders(
//                                List.of(new BasicHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString())))
//                        .addInterceptorLast((HttpResponseInterceptor) (response, context)
//                                -> response.addHeader("X-Elastic-Product", "Elasticsearch"))).build();
//        ElasticsearchTransport transport = new RestClientTransport(
//                restClient, new JacksonJsonpMapper());
//        ElasticsearchClient client = new ElasticsearchClient(transport);
//        return client;
//    }
}
